{extend name="$_admin_layout"}

{block name="tpl_vars"}
    {eq name="_request_action" value="create"}
        {php}$page_title = '新建配置';{/php}
    {else /}
        {php}$page_title = '修改配置：' . $config_info['title'];{/php}
    {/eq}
{/block}

{block name="main-content"}
    <div class="box box-blue no-heading">
        <div class="box-body">

                <form id="config_form" class="form form-manager">
                    <div class="row">
                        <div class="col-sm-12">
                            {:helper('admin/form')->render_group('name', $config_info['name'], 'text', '名称')}
                            {:helper('admin/form')->render_group('title', $config_info['title'], 'text', '标题')}
                            {:helper('admin/form')->render_group('group', $config_info['group'], 'text', '分组')}
                            {:helper('admin/form')->render_group('value', $config_info['value'], 'textarea', '配置值')}
                            {:helper('admin/form')->render_group('is_array', $config_info['is_array'], 'switch', '是否是数组？')}
                            {:helper('admin/form')->render_group('control', $config_info['control'], 'text', '编辑类型')}
                            {:helper('admin/form')->render_group('options', $config_info['options'], 'textarea', '编辑选项')}
                            {:helper('admin/form')->render_group('help', $config_info['help'], 'textarea', '编辑说明')}
                            {:helper('admin/form')->render_group('sort', $config_info['sort'], 'text', '排序')}
                            {:helper('admin/form')->render_group('status', $config_info['status'], 'switch', '状态')}
                            {:helper('admin/form')->render_submit_and_cancel(request()->url(), $_controller->url('index'))}

                            <script type="text/javascript">
                                $(function(){
                                    $('#config_form').bootstrapValidator({
                                        fields: {
                                            name: {
                                                validators: {
                                                    notEmpty: {
                                                        message: '名称不能为空',
                                                    },
                                                },
                                            },
                                            title: {
                                                validators: {
                                                    notEmpty: {
                                                        message: '标题不能为空',
                                                    },
                                                },
                                            },
                                        },
                                    });
                                });
                            </script>
                       </div>
                    </div>
                </form>

            </div>
        </div>
    </div>
{/block}